package com.coollang.smartbra.eventbus;

import android.graphics.drawable.Animatable;

/**
 * 作者：陈冬冬
 * <p>
 * 说明：使用EventBus传递一个字符串和2个标记字符，需要传递其他类型的数据得重新写一个类
 * <p>
 * EventBus使用参考网站：http://blog.csdn.net/harvic880925/article/details/40660137
 * <p>
 * 例如：在SmartBraHttp请求服务器发送消息，EventBus.getDefault().post(new
 * CommonEvent(result,1));
 * <p>
 * 在LoginActivity中接收消息，在onCreate中注册EventBus,在onDestory中反注册 在public void
 * onEventMainThread(CommonEvent event) 方法中接收处理消息
 * <p>
 * 时间：2015-12-28 上午11:13:54
 */
public class CommonEvent {


    public Boolean b;
    public byte[] bytes;
    public Animatable anim;//gif动画
    public String msg; // 接收的消息内容
    // 标记请求服务的状态
    public int what; // 1表示请求成功，0表示请求失败，-1表示连接服务器失败
    public static final int REQUESTSUEECCD = 1;
    public static final int REQUESTFAILUE = 0;
    public static final int LINKFAILUE = -1;
    public static final String FAIL = "FAIL";

    //标记是哪里的发送的消息,每次使用时记得在下面写上注释，避免重复使用同一个标记
    public int type;
    public static final int CLOSEDRAWERS = 0; //关闭首页侧滑
    public static final int LOADFINISHED = 1; //gif动画加载完毕
    public static final int GOTOREGIST = 2;//跳转到注册
    public static final int GOTOCHANGEPASS = 3;//跳转到修改密码
    public static final int GOTOLOGIN = 4;//跳转到登录
    public static final int GOTOSTATEMENT = 5;//跳转至免责声明
    public static final int GETCODE = 6; //获取验证码
    public static final int SELECTDATE = 7; //选中日期
    public static final int SETHEIGHT = 8; //设置高度
    public static final int SETWEIGHT = 9; //设置重量
    public static final int SETDATE = 10;//设置日期
    public static final int EDITNAME = 11;//修改昵称
    public static final int UPLOADHEADICON = 12;//上传头像
    public static final int GETUSERINFO = 13;//获取个人信息
    public static final int UPDATEUSERINFO = 14;//修改个人信息
    public static final int USERINFOCHANGE = 15;//个人信息修改 我的页面刷新
    public static final int GETSPORTDATES = 16;//有运动的日期和完成度
    public static final int UPDATESOFTWARE = 17;//版本更新
    public static final int GETMYPLAN = 18;//获取个人计划
    public static final int GETPLANFINISHEDBYDATE = 19;//具体某天的完成度
    public static final int UPDATE_SPORTPLAN = 20;//修改计划成功
    public static final int GETPERSONALMAINDATA = 21;//我的统计数据
    public static final int UPLOADSTEPDATA = 22;//上传步数
    public static final int GETDAYDETAILDATA = 23;//某天的详细数据
    public static final int UPLOAD_COUNTTYPEDATA = 24;//上传计数数据
    public static final int UPLOAD_TIMETYPEDATA = 25;//上传计时数据
    public static final int CONNECTSUCCESS = 26;//连接成功
    public static final int UPLOADCOUNTADATAGAIN = 27;//再次上传计数数据成功
    public static final int UPLOADTIMEDATAGAIN = 28;//再次上传计时数据成功
    public static final int UPLOADRUNDATAGAIN = 29;//再次上传跑步数据成功
    public static final int DEVICEISBIND = 30;//设备是否绑定
    public static final int ADDBIND = 31;//绑定设备
    public static final int GETBINDLIST = 32;//绑定设备列表
    public static final int UNBIND = 33;//解除绑定
    public static final int START = 34;//开始运动
    public static final int GETTODAYDETAILDATA = 35;//当天的详细数据
    public static final int GETACTIONDATA = 36;//获取统计数据
    public static final int GOTOFIRSTFRAGMENT = 37;//关闭充电预热弹窗去首页
    public static final int UPLOADRUNDATA = 38;//上传跑步数据成功
    public static final int ADDSPORTPLAN = 39;//添加计划成功
    public static final int CEJIUJING = 40;//测酒精
    public static final int CEHUANJING = 41;//测环境
    public static final int LOGINSUCCESS = 42;//登录成功
    public static final int CHANGESUCCESS = 43;//登录成功
    public static final int REGISTSUCCESS = 44;//登录成功
    public static final int DISPALYALL = 45;//抽屉布局显示电量和版本号
    public static final int EDITNAMESUCCESS = 46;//修改名字成功
    public static final int HASSPORT = 47;//有运动去获取统计数据
    public static final int REFRESHSTEPS = 48;//同步步数
    public static final int GOCHANGEPASSWORD = 49;//修改密码页面，带手机号过去
    public static final int GOREGIST = 50;//注册页面，带手机号过去
    public static final int TOLOGIN = 51;//修改密码页面，带手机号和密码过去
    public static final int TOLOGINTWO = 52;//修改密码页面，带手机号和密码过去
    public static final int GETLASTVERSION = 53;//获取固件版本
    public static final int SPORTFINISH = 54;//运动结束
    public static final int HASNEWVERSION = 55;//有新版本
    public static final int GOTOEN = 56;//去环境页面
    public static final int GOHOME = 57;//去主页
    public static final int DISPLAYDEFAULT = 58;//侧滑显示默认
    public static final int GETHIGHTIME = 59;//获取平板支撑最大记录
    public static final int REFRESHLOGIN = 60;//刷新cookie
    public static final int CHECKMAC = 61;
    public static final int GETDATA = 62;
    public static final int UPLOADDATASUCCESS = 63;//主页自动上次树精成功
    public static final int UNLOCK = 64;//滑动解锁
    public static final int kk = 65;//滑动解锁
    public static final int ACTIONACTIVITY_FINISH = 66;//滑动解锁


    public static final int BLE_STATE = 66;//滑动解锁

    public CommonEvent(String msg, int what, int type) {
        this.msg = msg;
        this.what = what;
        this.type = type;
    }

    public CommonEvent(boolean b, int what, int type) {
        this.b = b;
        this.what = what;
        this.type = type;
    }

    public CommonEvent(Animatable anim, int what, int type) {
        this.anim = anim;
        this.what = what;
        this.type = type;
    }

    public CommonEvent(byte[] bytes, int what, int type) {
        this.bytes = bytes;
        this.what = what;
        this.type = type;
    }
}
